package cn.itcast.controller;

import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class LoginController {

    @RequestMapping("/login")
    public String userLogin(){
        return "login.html";
    }

    @RequestMapping("/logout")
    public String userLogout(){
        return "login.html";
    }

    @RequestMapping("/login-error")
    public String loginError(){
        return "login.html";
    }

    @RequestMapping("/whoim")
    public Object whoIm(){
        return SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    }
}
